package org.setamv.springcloud.feign.raw;

import feign.Headers;
import feign.Param;
import feign.RequestLine;
import org.setamv.springcloud.dto.OpsResponse;
import org.setamv.springcloud.entity.User;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;

/**
 * 定义feign的接口
 */
public interface RawFeignClient {

    @RequestLine("GET /greetings/from/{yourName}")
    String sayHello(@Param("yourName") String yourName);

    @RequestLine("GET /user/{id}")
    public User getUser(@Param("id") String id);

    /**
     * feign的POST方式提交json数据
     * @param user
     * @return
     */
    @RequestLine("POST /user/create")
    @Headers("Content-Type: application/json")
    public OpsResponse createUser(User user);

    /**
     * feign的POST方式提交xml数据，并接收xml数据
     */
    @RequestLine("POST /user/echo/by/xml")
    @Headers("Content-Type: application/xml")
    public User echoByXml(User user);
}
